package mediator;

import java.util.HashMap;

/**
 * @Author shenhan
 * @Date: 2020/4/10 22:44
 * @Description:
 */
public class CurrentMediator extends Mediator {
    private HashMap<String, Colleague> colleagueHashMap;
    private HashMap<String, String> interMap;

    public CurrentMediator() {
        colleagueHashMap = new HashMap<>();
        interMap = new HashMap<>();
    }

    @Override
    void register(String colleagueName, Colleague colleague) {
        colleagueHashMap.put(colleagueName, colleague);
        if (colleague instanceof Alarm) {
            interMap.put("Alarm", colleagueName);
        }
    }

    @Override
    void getMessage(int stateChange, String colleagueName) {
        if (colleagueHashMap.get(colleagueName) instanceof Alarm) {
            if (stateChange == 0) {
                colleagueHashMap.get(interMap.get("CoffMachine"));
            }
        }
    }

    @Override
    void sendMessage() {

    }
}
